package com.mzkj.wanjulaile.mobile.api.modules.coupon.entity;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mzkj.wanjulaile.mobile.api.common.entity.DataEntity;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 优惠券Entity
 *
 * @author hgw
 * @version 2016-11-11
 */
public class Coupon extends DataEntity<Coupon> {

    private static final long serialVersionUID = 1L;
    private String name;        // 券名称
    private String introduce;        // 券简介
    private PromotionActivity activity;        // 优惠活动id
    private String vipSchemeType;        // 使用等级
    private String couponType;        // 优惠券类型  1:会员费抵用券  2:运费抵用券
    private String faceValue;        // 券的面值(单位：分)
    private String periodValidity;        // 有效期天数
    private Date startDate;        // 起始时间
    private Date endDate;        // 终止时间
    private Integer sort;		//排序字段
    private Integer couponMode; //优惠券方式  1:满减券  2:折扣券
    private Integer discount;   //折扣(%)
    private Integer maxDiscountMoney;  //折扣封顶金额
    private Integer minAmount;  //满减券使用需达到的金额

    private String sendFlag;	//是否发放 (0是(默认) 1(否))
    /**
     * 会员费抵用券
     */
    public static final String COUPON_TYPE_ACCOUNT = "1";
    /**
     * 运费抵用券
     */
    public static final String COUPON_TYPE_FREIGHT = "2";


    public Coupon() {
        super();
    }

    public Coupon(String id) {
        super(id);
    }

    @Length(min = 0, max = 255, message = "券名称长度必须介于 0 和 255 之间")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIntroduce() {
        return introduce;
    }

    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }

    @JsonBackReference
    @NotNull(message = "优惠活动id不能为空")
    public PromotionActivity getActivity() {
        return activity;
    }

    public void setActivity(PromotionActivity activity) {
        this.activity = activity;
    }

    public String getVipSchemeType() {
        return vipSchemeType;
    }

    public void setVipSchemeType(String vipSchemeType) {
        this.vipSchemeType = vipSchemeType;
    }

    public String getCouponType() {
        return couponType;
    }

    public void setCouponType(String couponType) {
        this.couponType = couponType;
    }

    public String getFaceValue() {
        return faceValue;
    }

    public void setFaceValue(String faceValue) {
        this.faceValue = faceValue;
    }

    public String getPeriodValidity() {
        return periodValidity;
    }

    public void setPeriodValidity(String periodValidity) {
        this.periodValidity = periodValidity;
    }

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public Integer getCouponMode() {
        return couponMode;
    }

    public void setCouponMode(Integer couponMode) {
        this.couponMode = couponMode;
    }

    public Integer getDiscount() {
        return discount;
    }

    public void setDiscount(Integer discount) {
        this.discount = discount;
    }

    public Integer getMaxDiscountMoney() {
        return maxDiscountMoney;
    }

    public void setMaxDiscountMoney(Integer maxDiscountMoney) {
        this.maxDiscountMoney = maxDiscountMoney;
    }

    public Integer getMinAmount() {
        return minAmount;
    }

    public void setMinAmount(Integer minAmount) {
        this.minAmount = minAmount;
    }

    public String getSendFlag() {
        return sendFlag;
    }

    public void setSendFlag(String sendFlag) {
        this.sendFlag = sendFlag;
    }
}